package com.dong.cjlibproxy;

import java.util.List;

/**
 * 封装调用关系
 */
public class Chain {
    private List<ChainHandler> handlerList;

    public Chain(List<ChainHandler> handlerList) {
        this.handlerList = handlerList;
    }
    private int index = 0;

    public void execute() {
        if(index>handlerList.size()-1) {
            return;
        }
        handlerList.get(index++).execute(this);;
    }
}
